﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrderDelive.aspx.cs" Inherits="qy_54tss_Admin_GpsSet_OrderDelive"
    EnableEventValidation="false" ValidateRequest="false" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html>
<html>
<head runat="server">
    <title>订单调度系统-<%= WebUtility.GetMyName() %></title>
    <link href="css/indis_style.css" rel="stylesheet" type="text/css" />
    <link href="../css/divDialog.css" rel="stylesheet" type="text/css" />
    <link href="../../javascript/jbox/Skins/jbox.css" rel="stylesheet" />
    <link href="../javascript/autocomplete/jquery.autocomplete.css" rel="stylesheet" />

    <script src="../javascript/eventwrapper.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>

    <script src="/Admin/js/jquery.js"></script>
    <script src="/Admin/js/jquery-1.8.3.min.js"></script>

    <script src="../JavaScript/ShowDivDialog.js" type="text/javascript"></script>
    <script src="../javascript/Common.js?v=2016072623"></script>

    <script src="javascript/orderdeliver.js?v=2016100601"></script>



    <script src="../../javascript/jCommon.js?v=2016072655"></script>

    <script src="../../javascript/jquery.floatDiv.js" type="text/javascript"></script>
    <script src="../../javascript/jbox/jquery.jBox-2.3.min.js"></script>
    <script src="../javascript/autocomplete/jquery.autocomplete.js?v=1103"></script>


    <script type="text/javascript">

        var NearbyDelivery = [];
        var Table;
        $(document).ready(function () {

            $(".indis_left").css("height", "538px");
            pageinit();
            //每分钟提醒
            Tellmsg();
            setInterval("Tellmsg()", 60000);


            var id = $("#hfflag").val();
            if (id == "1") {
                show_citytable();
            }

            delayURL();

        })

        function init() {
            Table = new CheckTable("indis_order_list_table");
            $(".indis_order_list_table tr").mouseover(function () { $(this).addClass("on-mouse"); }).mouseout(function () { $(this).removeClass("on-mouse") });

            $(".indis_order_list_table tr").click(function () { $(".indis_order_list_table tr").removeClass("invalid"); $(this).addClass("invalid"); })

            $(".indis_order_list_table tr:even").addClass("even pointer");
            $(".indis_order_list_table tr").addClass(" pointer");

            var type = request("type");
            if (type.length == 0) {
                type = "0";
            }
            $("#menu" + type).addClass("cur");

            var type = handlecookie("admin_scope");
            if (type == null) {
                type = "0";
            }
            $("#scope" + type).css({ color: "red" });





            $("#ddlscope").val(type);


        }

        function pageinit() {
            init();
            hideload_super('dddd');
        }

        function serchorder() {
            var key = $("#tbkeyword").val() + "";
            if (key == "" || key == "可按照电话、姓名、订单号查询") {
                alert("可按照电话、姓名、订单号查询");
                return false;
            }
            return true;
        }

        function delayURL() {
            var timebox = $("#time");
            var delay = parseInt(timebox.html());
            if (delay > 0) {
                delay--;
                timebox.html(delay + "");
            }

            setTimeout(delayURL, 1000);
        }

        //通知事件
        function play(flag) {
            $("#time").html(60);
            init();
            if (flag == 0) {
                return;
            }
            // soundManager.play('mySound1', 'notify.mp3');
        }

        function settable(name, cursel, n, css, defaut) {
            for (i = 1; i <= n; i++) {
                var menu = document.getElementById(name + i);
                if (i == cursel) {
                    menu.className = css;
                    $("#" + name + "_div" + i).show();
                }
                else {
                    if (typeof defaut != 'undefined') {
                        menu.className = defaut;
                    }
                    else {
                        menu.className = "";
                    }
                    $("#" + name + "_div" + i).hide();
                }
            }
        }

        function go(tag) {
            var v = $(tag).val() + "";

            window.location = 'OrderDelive.aspx?scope=' + v;
        }

        //onclick="alert()"
    </script>

    <style type="text/css">
        .system_shop {
            border: solid red 1px;
        }
    </style>

</head>
<body>
    <form id="form1" runat="server">
        <asp:HiddenField runat="server" ID="hidLat" />
        <asp:HiddenField runat="server" ID="hidLng" />
        <asp:HiddenField runat="server" ID="hfcityname" />
        <asp:HiddenField runat="server" ID="hfcityid" Value="0" />
        <asp:HiddenField runat="server" ID="hfflag" Value="0" />
        <asp:HiddenField runat="server" ID="hf_curr_dids" />
        <asp:HiddenField runat="server" ID="hforderuserlatlng" />



        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div class="wrap">
            <div class="indis_top">
                <a href="../../index.aspx" class="float_l padding_l5">
                    <img src="../../images/logo.png?v=1" style="height: 75px;" /></a>
                <span
                    class="top_title">调度订单</span>


                <span>
                    <label style="font-size: 14px;">

                        <select id="ddlscope" onchange="go(this)">

                          
                            <option value="8888">全站</option>

                            <asp:Repeater runat="server" ID="rptmygroup">
                                <ItemTemplate>
                                        <option value="<%# Eval("id") %>"><%# Eval("classname") %></option>
                                </ItemTemplate>
                            </asp:Repeater>



                        </select>

                        <a href="OrderDelive.aspx?scope=8888" style="float: none; display:none;" id="scope8888" class="float_l padding_l5">全站</a>


                    </label>

                </span>

                <span>

                    <span style="padding-top: 0; margin-left: 100px;">
                        <label id="time" style="color: Red; font-size: 23px;">60</label>秒后自动刷新</span>
                </span>


                <p>
                    <label runat="server" id="snDate">
                    </label>
                </p>
                <p>
                    <a href="../basic.aspx">返回后台</a>
                </p>
            </div>
            <div class="indis_con">
                <div class="indis_left" style="height: 538px; overflow-y: scroll;" id="sidebar">
                    <h4 style="line-height: 30px;">配送骑士状态信息<a href="javascript:void(0)" onclick="$('#colorremark').toggle()" style="font-size: 12px; color: red;">(状态-颜色)</a>[<span><a href="javascript:void(0)" onclick="LoadDeliver(9)" style="font-size: 12px; color: red;">刷新</a></span>]</h4>
                    <div id="colorremark" style="display: none;">
                        <center style="margin-bottom: 10px;">状态与颜色对应关系如下</center>
                        <ul style="margin-bottom: 20px;">
                            <li class="kongxian"><a href="javascript:void(0)">
                                <p>待岗</p>
                            </a></li>
                            <li class="qingjia quhuo"><a href="javascript:void(0)">
                                <p>取货中</p>
                            </a></li>
                            <li class="peisong"><a href="javascript:void(0)">
                                <p>送货中</p>
                            </a></li>
                            <li class="likai yichang"><a href="javascript:void(0)">
                                <p>异常</p>
                            </a></li>
                        </ul>

                    </div>

                    <div style="padding-left: 20px;">

                        <select id="ddlStatus" name="ddlStatus" class="j_select" onchange="LoadDeliver(9)">
                            <option value="1">正常</option>
                            <option value="0">离线</option>

                        </select>

                        &nbsp;

                         <select id="ddlCodeId" name="ddlCodeId" class="j_select" onchange="LoadDeliver(9)">
                             <option value="1">上班</option>
                             <option value="0">休息</option>

                         </select>



                    </div>


                    <div style="margin: 10px;">
                    </div>
                    <div id="divDeliver" style="min-height: 200px;">
                    </div>
                    <div id="loading-divDeliver" style="height: 200px; text-align: center;">
                        <p class="loader" id="loading_mask_loader">
                            <img src="../images/ajax-loader-tr.gif" alt="搜索中..." /><br />
                            数据加载中...
                        </p>
                    </div>

                </div>
                <div class="indis_right" style="width: 79.8%;">
                    <div class="indis_right_top">
                        <div class="indis_right_map">
                            <div id="map_canvas" style="width: 100%; height: 538px">
                            </div>
                        </div>
                        <div class="indis_order_detail">
                            <div class="indis_order_detail_con">
                                <div>
                                    <div style="float: left; padding-top: 10px;">配送人员：</div>
                                    <div style="float: left; line-height: 40px;">
                                        <div style="margin-bottom: 10px;">
                                            <!-  onkeydown="return enterIn(event,spreadOne2deliver)" ->
                                            <asp:TextBox ID="tbdeliver" placeholder="快速搜索配送员" Width="100" runat="server" CssClass="j_text"></asp:TextBox>
                                        </div>
                                        <div>
                                            <asp:DropDownList ID="ddldeliver" runat="server" Width="100px" CssClass="j_seclect"
                                                onchange="getsubsort();">
                                                <asp:ListItem Value="0">选择配送人员</asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                    <div class=" clear"></div>
                                </div>
                                <div style="margin-top: 10px;">
                                    群组：<asp:DropDownList ID="ddlgroup" runat="server" Width="100px" CssClass="j_seclect"
                                        AppendDataBoundItems="true">
                                        <asp:ListItem Value="0">选择群组</asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <asp:HiddenField runat="server" ID="hfdid_hh" Value="0" />
                                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                    <ContentTemplate>
                                        <p>
                                            <asp:HiddenField runat="server" ID="hfstate" Value="0" />
                                            <asp:HiddenField runat="server" ID="hfordersection" Value="0" />
                                            <asp:HiddenField runat="server" ID="hforderid" Value="" />
                                            <textarea id="tborderinfo" class="order_detail_textarea" runat="server" style="height: 200px; display: none"></textarea>
                                        </p>
                                        <p style="text-align: right;">


                                            <asp:Button runat="server" ID="tbsearch" class="my_btn" Text="发人" OnClick="deliver_click" Style="float: right; margin-right: 50px;"
                                                OnClientClick="return checkdeliver()" />




                                            <asp:Button runat="server" ID="Button4" class="my_btn" Text="发群" OnClick="sendgroup_click"
                                                OnClientClick="return checksendgroup()" />




                                        </p>

                                        <div class=" clear"></div>


                                    </ContentTemplate>
                                </asp:UpdatePanel>
                                <div class="clear">
                                </div>
                                <div class="indis_state">
                                    <div id="ul_sum">
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clear">
                </div>
                <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="60000">
                </asp:Timer>
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                    </Triggers>
                    <ContentTemplate>
                        <div class="shop_menu" style="margin-bottom: 5px;">
                            <ul>
                                <li id="menu0"><a href="OrderDelive.aspx?type=0&scope=<%= Request.QueryString["scope"] %>">未调度</a></li>
                                <li id="menu10"><a href="OrderDelive.aspx?type=10&scope=<%= Request.QueryString["scope"] %>">未接收</a></li>
                                <li id="menu1"><a href="OrderDelive.aspx?type=1&scope=<%= Request.QueryString["scope"] %>">未完成</a></li>
                                <li id="menu2"><a href="OrderDelive.aspx?type=2&scope=<%= Request.QueryString["scope"] %>">所有</a></li>

                                <li style="background-color: #fff; border: none; height: 33px;">

                                    <asp:Button runat="server" ID="btclear" class="form-button" Text="清空GPS数据" OnClick="clearGPSReclord_Click" />&nbsp;&nbsp;
                                                    
                                                <asp:Button runat="server" ID="btclear30day" CommandArgument="1" class="form-button" Text="删除1天前的GPS数据" OnClick="delGPSReclord_Click" />&nbsp;&nbsp;
                                                 
                                                <asp:Button runat="server" ID="btclear7day" CommandArgument="7" class="form-button" Text="删除7天前的GPS数据" OnClick="delGPSReclord_Click" />&nbsp;&nbsp;

                                </li>

                            </ul>
                        </div>


                        <div class="" style="margin: 20px; overflow: hidden;">
                            <input name="" type="text" class="search_hujiao_text" value="" placeholder="电话、姓名、订单号查询" runat="server" id="tbkeyword"
                                style="width: 160px;" />


                            骑士:<input name="" type="text" class="search_hujiao_text" value="" placeholder="骑士查询" runat="server" id="tbdelivername"
                                style="width: 160px;" />

                            备注:<input name="" type="text" class="search_hujiao_text" value="" placeholder="备注查询" runat="server" id="tbOrderAttach"
                                style="width: 160px;" />

                            地址:<input name="" type="text" class="search_hujiao_text" value="" placeholder="地址查询" runat="server" id="tbAddressText"
                                style="width: 160px;" />

                            <asp:DropDownList ID="ddlstate" runat="server" Width="80px" CssClass="j_seclect" AppendDataBoundItems="true"
                                Style="margin-left: 5px;">
                                <asp:ListItem Value="0">所有状态</asp:ListItem>
                            </asp:DropDownList>





                            <asp:Button runat="server" ID="Button2" class="my_btn" Text="搜索" OnClick="search_click" Style="float: none;" />

                        </div>
                        <div class="clear">
                        </div>


                        <div id="shop_menu__div1" style="padding-bottom: 50px;">
                            <div class="indis_order_list">
                                <table class="indis_order_list_table" id="indis_order_list_table" width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <th width="3%">&nbsp;
                                        </th>
                                        <th width="4%">

                                            <asp:LinkButton CommandArgument="deliverheaderid desc , SendTime " CommandName="deliverheaderid asc , SendTime " OnClick="sort_click" Style="color: red"
                                                runat="server" ID="lbdeliverheaderid">商圈</asp:LinkButton>



                                        </th>
                                        <th width="6%">订单号
                                        </th>
                                        <th width="10%">状态-骑士-商家
                                        </th>

                                        <th width="4%">
                                            <asp:LinkButton CommandArgument="SendTime asc,orderdatetime " CommandName="SendTime desc,orderdatetime " OnClick="sort_click" Style="color: red"
                                                runat="server" ID="LinkButton3">出餐时间</asp:LinkButton>
                                        </th>

                                        <th width="8%">
                                            <asp:LinkButton CommandArgument="Name asc,OrderAddress asc,SendTime" CommandName="Name desc,OrderAddress asc,SendTime" OnClick="sort_click" Style="color: red"
                                                runat="server" ID="shopsort">商家</asp:LinkButton>
                                        </th>

                                        <th width="5%">客人电话
                                        </th>
                                        <th>地址
                                        </th>

                                        <th width="4%">距离
                                        </th>

                                        <th width="6%">备注
                                        </th>

                                        <th width="4%">
                                            <asp:LinkButton CommandArgument=" OrderAddress asc,SendTime asc,Name" CommandName=" OrderAddress desc,SendTime asc,Name" OnClick="sort_click" runat="server" Style="color: red" ID="LinkButton1">处理人</asp:LinkButton>
                                        </th>


                                        <th width="5%">
                                            <asp:LinkButton CommandArgument="DeliverName asc,Name asc,SendTime" CommandName="DeliverName desc,Name asc,SendTime" OnClick="sort_click" runat="server" Style="color: red" ID="LinkButton2">骑士</asp:LinkButton>
                                        </th>
                                        <th width="6%">连单备注
                                        </th>
                                        <th width="4%">超时
                                        </th>
                                        <th width="4%">
                                            <label runat="server" id="lbsendtimelabel">配送计时</label>
                                        </th>
                                        <th width="3%">编辑
                                        </th>
                                    </tr>
                                    <asp:Repeater runat="server" ID="rptOrderList">
                                        <ItemTemplate>
                                            <tr id="tr<%# Eval("orderid")%>">
                                                <td>
                                                    <%# (Container.ItemIndex+1).ToString() %>
                                                    <input name="" id="_inut" value="<%# Eval("Unid")%>" class="massaction-checkbox"
                                                        type="checkbox">
                                                </td>

                                                <td>
                                                    <%# Eval("groupname")%>
                                                </td>

                                                <td>
                                                    <label id="latlng_<%# Eval("OrderId") %>" style="display: none;">
                                                        <%# Eval("ReveVar2")%></label>
                                                    <a href="javascript:" onclick="showorderlocal(<%# Eval("OrderStatus") %>,0,<%# Eval("DeliveInfo.DeliverId") %>,'<%# Eval("orderid") %>','<%# Eval("OrderRcver") %>','<%# Eval("AddressText") %>','<%# Eval("togoname") %>','0',<%# Eval("togoid") %>)">
                                                        <%# Eval("OrderId") %></a>
                                                </td>
                                                <td>

                                                    <div style="cursor: pointer;" ondblclick="canceldispatch('<%# Eval("orderid")%>',<%# Eval("OrderStatus") %>,<%# Eval("DeliverId") %>)">
                                                        <%#WebUtility.TurnOrderState(Eval("OrderStatus").ToString())%>-<%#WebUtility.TurnOrderSendState(Eval("sendstate").ToString())%>-<%# Hangjing.WebCommon.WebHelper.TurnOrderReceiveState(Eval("isshopset")) %>-<%# WebUtility.TurnPayState(Eval("paystate")) %>
                                                    </div>
                                                </td>

                                                <td>


                                                    <div style="cursor: pointer;" ondblclick="editsendtime('SendTime','期望时间','<%# Eval("Unid")%>','<%# Convert.ToDateTime(Eval("SendTime").ToString()).ToString("yyyy-MM-dd")%>')">

                                                        <label id="lbSendTime<%# Eval("Unid")%>"><%# Convert.ToDateTime(Eval("SendTime").ToString()).ToString("HH:mm")%></label>&nbsp;

                                                    </div>
                                                </td>


                                                <td title="<%# Eval("TogoName")%>">
                                                    <%#WebUtility.Left(Eval("TogoName"), 8)%>
                                                </td>

                                                <td>
                                                    <%# Eval("OrderComm")%>
                                                </td>
                                                <td title="<%# Eval("AddressText")%>" style="text-align: left;">
                                                    <%#WebUtility.Left(Eval("AddressText"), 30)%>
                                                </td>


                                                <td>
                                                    <%# Eval("cardpay")%>
                                                </td>


                                                <td title="<%# Eval("OrderAttach")%>">

                                                    <div style="cursor: pointer;" ondblclick="editinfo('OrderAttach','备注','<%# Eval("Unid")%>')">
                                                        <label id="lbOrderAttach<%# Eval("Unid")%>"><%#Eval("OrderAttach")%></label>&nbsp;
                                                    </div>

                                                </td>


                                                <td>
                                                    <%# Eval("OrderAddress")%>
                                                </td>


                                                <td>
                                                    <label id="delivername_order_<%# Eval("Unid")%>"><%# Eval("DeliveInfo.DeliverName")%></label>

                                                </td>


                                                <td title="<%# Eval("Mergeorderremark")%>">
                                                    <div style="cursor: pointer;" ondblclick="editinfo('Mergeorderremark','连单备注','<%# Eval("Unid")%>')">
                                                        <label id="lbMergeorderremark<%# Eval("Unid")%>"><%#Eval("Mergeorderremark")%></label>&nbsp;
                                                    </div>
                                                </td>


                                                <td>

                                                    <%# Eval("DeliveInfo.ordertimesum")%>
                                                   
                                                </td>

                                                <td>

                                                    <%# Eval("DeliveInfo.OverTimeStr")%>
                                                  
                                                </td>

                                                <td>

                                                    <a href="/admin/shop/OrderDetail.aspx?id=<%# Eval("unid") %>" target="_blank">编辑</a>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </table>
                            </div>
                            <div class="pages">
                                <webdiyer:AspNetPager CssClass="anpager" ID="AspNetPager1" runat="server" Width="100%"
                                    CustomInfoHTML="共有记录 <font>%RecordCount%</font> 条 当前为 <font>%CurrentPageIndex%</font>/<font>%PageCount%</font> 页"
                                    HorizontalAlign="Left" ShowCustomInfoSection="Left" CustomInfoTextAlign="Center"
                                    CustomInfoSectionWidth="28%" ShowPageIndexBox="Always" PageIndexBoxType="TextBox"
                                    TextBeforePageIndexBox="转到 " PageIndexBoxClass="flattext" ShowPageIndex="True"
                                    PageSize="100" SubmitButtonClass="flatbutton" SubmitButtonText="GO " TextAfterPageIndexBox=" 页 "
                                    Wrap="False" OnPageChanged="AspNetPager1_PageChanged">
                                </webdiyer:AspNetPager>
                            </div>
                        </div>



                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
        </div>


        <script type="text/javascript">
            function loading() {
                $("#loading-divDeliver").show();
            }

            function loadover() {
                $("#loading-divDeliver").hide();
            }



            function LoadDeliver(type) {
                var hfcityid = $("#hfcityid").val();
                markerlist.length = 0;
                var data = "type=" + type + "&sname=" + "" + "&cid=" + hfcityid;
                var ddlStatus = $("#ddlStatus").val();
                if (ddlStatus != "-1") {
                    data += "&status=" + ddlStatus;
                }
                var ddlCodeId = $("#ddlCodeId").val();
                if (ddlCodeId != "-1") {
                    data += "&codeid=" + ddlCodeId;
                }

                var scope = request("scope");
                if (scope.length == 0) {
                    scope = "0";
                }

                data += "&scope=" + scope;



                $.ajax({
                    type: "get",
                    url: "../ajax/GetDeliverList.aspx",
                    cache: false,
                    dataType: "html",
                    data: data,
                    beforeSend: function (XMLHttpRequest) {
                        loading();
                    },
                    success: function (data, textStatus) {
                        //处理数据
                        $("#divDeliver").html(data);

                        loadover();

                        //显示所有配送员
                        var deliverlist = eval("(" + $("#deliverlistjson").val() + ")");
                        map.clearOverlays();
                        for (var i = 0; i < deliverlist.length; i++) {
                            var d_point = new BMap.Point(deliverlist[i].Lng, deliverlist[i].Lat); // 创建点坐标
                            var d_icon = new BMap.Icon('/Admin/Service/images/mapmarker/marker_' + deliverlist[i].workstate + '.png', new BMap.Size(20, 34), { anchor: new BMap.Size(10, 0) });
                            var d_marker = new BMap.Marker(d_point, { icon: d_icon });
                            var deliverlabel = new BMap.Label(deliverlist[i].Name + "(" + deliverlist[i].OrderNum + ")", { offset: new BMap.Size(-28, -22) });
                            deliverlabel.setStyle({ color: "blue", fontSize: "12px", padding: "2px 5px 2px 5px" });
                            d_marker.setLabel(deliverlabel);
                            d_marker.setTitle(deliverlist[i].DataId);
                            map.addOverlay(d_marker);

                            d_marker.addEventListener("click", function (e) {

                                showDeliverBox(this.getTitle(), this);
                            });

                            markerlist.push(d_marker);
                        }

                    },
                    complete: function (XMLHttpRequest, textStatus) {
                        //$("#loading").html("加载完成");
                    },
                    error: function () {
                        //请求出错处理
                    }

                });

                return false;

            }


        </script>

        <script type="text/javascript">
            var gzoom = 17;
            var marker = null;
            var markerlist = new Array();
            var map = new BMap.Map("map_canvas"); // 创建地图实例
            map.enableScrollWheelZoom();
            var myGeo = new BMap.Geocoder();
            var _lat = parseFloat($("#hidLat").val());
            var _lng = parseFloat($("#hidLng").val());
            var initpoint = new BMap.Point(_lng, _lat); // 创建点坐标
            //图标
            var myIcon = new BMap.Icon("/Admin/images/marker50.png", new BMap.Size(20, 34), { anchor: new BMap.Size(10, 0) });

            var cityname = $("#hfcityname").val();
            map.centerAndZoom(initpoint, gzoom);

            map.addControl(new BMap.NavigationControl());  //缩放工具

            function setLatLng(point) {
                document.getElementById("hidLat").value = point.lat;
                document.getElementById("hidLng").value = point.lng;
                return true;
            }

            function showorder(shopid, orderid) {
                var sheight = window.screen.height - 70;
                var swidth = window.screen.width - 10;

                var winoption = "left=0,top=0,height=" + sheight + ",width=" + swidth + ",toolbar=yes,menubar=yes,location=yes,status=yes,scrollbars=yes,resizable=yes";
                var url = "updateorder.aspx?id=" + shopid + "&oid=" + orderid;
                window.open(url, "newwindow", winoption);
            }



            function select_mycity(name, id) {
                var url = "OrderDelive.aspx?cid=" + id + "&cname=" + escape(name);
                window.location = url;

            }
        </script>

    </form>
    <audio id="neworderAudio">
        <source src="new.wav" type="audio/mpeg"></audio>
    <audio id="chatAudio">
        <source src="notify.wav" type="audio/mpeg"></audio>

    <audio id="newweixinorderaudio">
        <source src="/shop/neworder.mp3" type="audio/mpeg"></audio>


</body>
</html>

<script src="../../javascript/jquery.floatDiv.js" type="text/javascript"></script>

<script type="text/javascript">

    //分配选中的订单给这个配送员
    function spread2deliver(did, name) {
        isdb = true;
        var oids = Table.GetChecks() + "";
        if (oids.length == 0) {
            alert("请选择订单");
            return;
        }

        var url = "/ajaxHandler.ashx";
        var para = "method=spread2deliver&did=" + did + "&t=" + new Date().getTime() + "&oids=" + oids + "&name=" + escape(name);
        jQuery.ajax(
        {
            type: "post",
            url: url,
            data: para,
            success: function (msg) {
                alert("订单已经分配成功");
                var ids = oids.split(",");
                for (var i in ids) {
                    $("#delivername_order_" + ids[i]).html(name);
                }
            }
        })
    }

    //分配一个订单给配送员
    function spreadOne2deliver() {
        var d_id = $("#hfdid_hh").val() + "";
        if (d_id == "0") {
            alert("请选择配送员。");
            return false;
        }
        var hforderid = $("#hforderid").val();
        if (hforderid.length == 0) {
            alert("请选择订单");
            return false;
        }

        $.jBox.tip("正在提交，请稍后", 'loading');

        var name = $("#ddldeliver  option:selected").text();


        var url = "/ajaxHandler.ashx";
        var para = "method=spreadOne2deliver&did=" + d_id + "&t=" + new Date().getTime() + "&oids=" + hforderid + "&name=" + escape(name);
        jQuery.ajax(
        {
            type: "post",
            url: url,
            data: para,
            success: function (msg) {
                $.jBox.tip('调度成功', 'success');
                $("#tr" + hforderid).remove();
            }
        })

    }



</script>
